home *** CD-ROM | disk | FTP | other *** search
- /* Programmer's guide to GEM - 1986 - p.157 -listing 3.1 - CJPurcell Dec'86 */
- /* CTRLNDC.C - MAIN DRIVER for draw_ndc() examples using Mark Williams C */
- /* to be tested in NDC and/or RC mode with or without GDOS for implications */
- #include <portab.h> /* ATARI DOGS & CATS */
- #include <osbind.h> /* system constants */
- #include <gemdefs.h> /* GEM-definition */
- /* #include <obdefs.h> / *object definition */
-
- WORD contrl[12], intin[128], ptsin[128], intout[128], ptsout[128];
-
- #define M_OFF 256
- #define NDC_COORDS 0
- #define RIGHT_ALIGNED 2
- #define BOTTOM_ALIGNED 3
-
- VOID main() /* not GEMAIN() */
- {
- WORD handle, work_in[11], work_out[57];
- WORD ii;
-
- appl_init(); /* init AES for call */
- handle = graf_handle( &ii,&ii,&ii,&ii ); /* get screen handle */
- graf_mouse( M_OFF, NULL ); /* hide mouse */
- v_clrwk( handle ); /* clear workstation */
-
- for( ii=0; ii<11; ++ii ) work_in[ii]=1; /* init work_in array*/
- work_in[10] = NDC_COORDS; /* using NDC coordinates*/
- v_opnvwk( work_in, &handle, work_out ); /* open the workstation */
-
- draw_ndc( handle ); /* do the examp.routine */
-
- vst_alignment( handle,RIGHT_ALIGNED,BOTTOM_ALIGNED,&ii,&ii );
- v_gtext( handle,32767,0,"Press any Key to Continue" );
- evnt_keybd(); /* pause for viewing */
- v_clsvwk( handle ); /* close workstation */
- appl_exit(); /* tell AES finished */
- }
-
- /* p.178 Listing 3.10 LINEWALK.C appended to CTRLNDC.C */
-
- VOID draw_ndc( handle ) WORD handle ;
- {
- WORD pxy[4];
- UWORD x1, y1, x2, y2, incr;
- x1 = 0;
- y1 = 0;
- x2 = 32767;
- y2 = 32767;
- incr = 1000;
- while( x1 < 32767 )
- {
- pxy[0] = x1;
- pxy[1] = y1;
- pxy[2] = x2;
- pxy[3] = y2;
- v_pline(handle, 2, pxy); /* output 2 point polyline */
- x1 += incr;
- y1 += incr;
- x2 -= incr;
- }
- } /* CJPurcell 07Dec'86 tests */
-